import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from "@/views/Layout.vue";

Vue.use(VueRouter)

const routes = [
    // =====    主页 =====
  {
    path: '/',
    name: 'Layout',
    component: Layout,
      redirect: '/home',  // 重定向到主页
      children: [
          {path: '/home', name: 'Home', component: () => import('@/views/HomeView.vue')},
          {path: '/record', name: 'Record', component: () => import('@/views/Record.vue'),},
          {path: '/share', name: 'Share', component: () => import('@/views/Share.vue')},
          {path: '/about', name: 'About', component: () => import('@/views/About.vue'),},
          {path: '/story', name: 'Story', component: () => import('@/views/Story.vue'),},
          {path: '/moreArticle', name: 'MoreArticle', component: () => import('@/views/MoreArticle.vue'),},
          {path: '/detail', name: 'Detail', component: () => import('@/views/Detail.vue')},
          {path: '/addArticle', name: 'AddArticle', component: () => import('@/views/AddArticle.vue')},
          {path: '/myArticle', name: 'MyArticle', component: () => import('@/views/MyArticle.vue')},
          {path: '/person', name: 'Person',meta:{name: '个人信息'},  component: ()=>import('../views/user/Person.vue')},
          {path: '/password', name: 'Password',meta:{name: '修改密码'},  component: ()=>import('../views/user/Password.vue')},

      ]
  },
    {path: '/login', name: 'Login', component: () => import('@/views/Login.vue')},
    {path: '/register', name: 'Register', component: () => import('@/views/Register.vue')},

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
